package com.olinsports.system.olinsportssystem.repository;

import com.olinsports.system.olinsportssystem.model.CommodityType;
import com.olinsports.system.olinsportssystem.model.InventoryDetails;
import com.olinsports.system.olinsportssystem.model.MultiCondition;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

/**
 * Created by Administrator on 2017/7/23.
 */
@Mapper
@CacheConfig(cacheNames = "inventoryDeatils")
public interface InventoryDetailsRepository {
    @Cacheable
    public List<InventoryDetails> selectAll();
    @Cacheable
    public int insertAll(InventoryDetails inventoryDetails);
    @Cacheable
    public int deleteByKey(int typeKey);
    @Cacheable
    public InventoryDetails selectByKey(int inventoryKey);
    @Cacheable
    public int updateData(InventoryDetails inventoryDetails);
    @Cacheable
    public int findCount();
    @Cacheable
    public List<InventoryDetails> findLimit(@Param("sord") String sord, @Param("sidx") String sidx, @Param("beg") int beg, @Param("end") int end);
    /**
     * 通过查询条件查出总个数
     * @param multiList
     * @return
     */
    @Cacheable
    public int  findByParamsCount(@Param("multiList") List<MultiCondition> multiList);

    /**
     * 通过查询条件进行分页查询
     * @param multiList
     * @param beg
     * @param end
     * @return
     */
    @Cacheable
    public List<InventoryDetails> findByParamsLimit(@Param("sord") String sord, @Param("sidx") String sidx, @Param("multiList") List<MultiCondition> multiList, @Param("beg") int beg, @Param("end") int end);

    @Cacheable
    public int selectByDateCount(@Param("startDate") String startDate,@Param("endDate") String endDate);

    @Cacheable
    public List<InventoryDetails> selectByDateLimit(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("beg") int beg, @Param("end") int end);

    @Cacheable
    public List<InventoryDetails> selectByDateAll(@Param("startDate") String startDate,@Param("endDate") String endDate);

    @Cacheable
    public int selectSelfCount(@Param("field") String field,@Param("fieldValue") String fieldValue);

    @Cacheable
    public List<InventoryDetails> selectSelfLimit(@Param("field") String field,@Param("fieldValue") String fieldValue,@Param("beg") int beg, @Param("end") int end);

}
